package com.atguigu.gulimall.auth.feign.fallback;

import com.atguigu.common.exception.BizCodeEnum;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.auth.feign.MemberFeignService;
import com.atguigu.gulimall.auth.vo.SocialUser;
import com.atguigu.gulimall.auth.vo.UserLoginVo;
import com.atguigu.gulimall.auth.vo.UserRegistVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @create: 2024/9/6
 * @author: gyhe10
 * @description:
 **/

@Slf4j
@Component
public class MemberFeignServiceFallback implements MemberFeignService {
    @Override
    public R regist(UserRegistVo vo) {
        log.error("远程调用 member 服务注册用户失败，注册用户名：{}，注册手机号：{}", vo.getUsername(), vo.getPhone());
        return R.error(BizCodeEnum.CALL_OTHER_SERVICE_EXCEPTION.getCode(), "远程调用 member 服务注册用户失败");
    }

    @Override
    public R login(UserLoginVo vo) {
        log.error("远程调用 member 服务登录失败，登录用户名：{}", vo.getLoginacct());
        return R.error(BizCodeEnum.CALL_OTHER_SERVICE_EXCEPTION.getCode(), "远程调用 member 服务登录失败");
    }

    @Override
    public R oauthLogin(SocialUser socialUser) {
        log.error("远程调用 member 服务社交登录失败，社交用户信息：{}", socialUser);
        return R.error(BizCodeEnum.CALL_OTHER_SERVICE_EXCEPTION.getCode(), "远程调用 member 服务社交登录失败");
    }
}
